# Maintainer: Andrea Scarpino <andrea@archlinux.org>

pkgname=libmusicbrainz5
pkgver=5.1.0
pkgrel=4
pkgdesc="Library That Provides Access to the MusicBrainz Server"
arch=('x86_64')
url='https://musicbrainz.org/doc/libmusicbrainz'
license=('LGPL2.1')
depends=('neon' 'libxml2')
makedepends=('cmake')
source=("https://github.com/metabrainz/libmusicbrainz/releases/download/release-${pkgver}/libmusicbrainz-$pkgver.tar.gz"
        16.patch)
sha256sums=('6749259e89bbb273f3f5ad7acdffb7c47a2cf8fcaeab4c4695484cef5f4c6b46'
            '5ad7e45b191cceca3bb71c92adb6c767ae8079bf2814354341fae829d4328ae9')

prepare() {
  cd libmusicbrainz-$pkgver

  # https://github.com/metabrainz/libmusicbrainz/pull/16
  patch -Np1 -i ../16.patch
}

build() {
  CFLAGS+=" $CPPFLAGS"
  CXXFLAGS+=" $CPPFLAGS"
  cmake -Hlibmusicbrainz-$pkgver -Bbuild \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=None
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --build build --target install
}
